#ifndef GY_IMAGSTATETOOLBUTTON_H
#define GY_IMAGSTATETOOLBUTTON_H

#include "GY_ControlLibrary_global.h"
#include "Buttons/GY_StateToolButton.h"
#include <QMouseEvent>

/** 自定义工具按钮图标设置
 * @brief The GY_ImagStateToolButton class
 */
class GY_CONTROLLIBRARY_EXPORT GY_ImagStateToolButton : public GY_StateToolButton
{
    Q_OBJECT
public:
    explicit GY_ImagStateToolButton(QWidget *parent = nullptr);

    /**
     * @brief setButtonIcon 设置按钮名称和图标
     * @param iconNormal 原始图标
     * @param iconHover 鼠标停留时的图标
     * @param iconPress 按下后的图标
     */
    void setButtonIcon(const QString  &iconNormal, const QString &iconHover = nullptr, const QString &iconPress = nullptr);

    void setImagIcon(const QString  &iconNormal);

protected:
    void enterEvent(QEvent *event);//鼠标悬停时
    void leaveEvent(QEvent *event);//鼠标离开时
    void mousePressEvent(QMouseEvent *event);//鼠标点击时

private slots:
    void rcvImagIconCganged(GY_StateToolButton* pbutton);

private:
    QString m_normal_icon; //原始图标
    QString m_hover_icon; //鼠标停留时的图标
    QString m_click_icon; //按下后的图标
};

#endif // GY_IMAGSTATETOOLBUTTON_H
